# _*_ coding: utf-8 _*_
from openerp import models, fields, api



class SaleOrderLine(models.Model):
    _inherit = "sale.order.line"

    product_url = fields.Char(string="Product URL", related="product_id.product_url")

    price_show = fields.Monetary(compute='_compute_price_show', string='含税单价')  # 用于打印的报价单显示单价，这时不显示折扣

    @api.depends('price_total')
    @api.multi
    def _compute_price_show(self):
        for line in self:
            if line.product_uom_qty:
                line.price_show = line.price_total / line.product_uom_qty

    # def action_open_product_url(self):
    #     print self.product_url